﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006">
    <Style x:Key="{x:Type GridViewColumnHeader}" TargetType="GridViewColumnHeader">
        <Setter Property="OverridesDefaultStyle" Value="True" />
        <Setter Property="Background" Value="{DynamicResource Brush.DataGridColumnHeader.Background}" />
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.DataGridColumnHeader.Border}" />
        <Setter Property="BorderThickness" Value="1,0,1,1" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Foreground" Value="{DynamicResource Brush.DataGridColumnHeader.Foreground}" />
        <Setter Property="FontSize" Value="12" />
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="MinHeight" Value="30" />
        <Setter Property="Padding" Value="10,0" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GridViewColumnHeader">
                    <Border 
                        Name="HeaderBorder"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        Background="{TemplateBinding Background}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <ContentPresenter 
                                Name="HeaderContent"
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}"
                                RecognizesAccessKey="True"
                                SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                            <Thumb 
                                Grid.Column="1"
                                x:Name="PART_HeaderGripper"
                                Cursor="SizeWE"
                                Margin="-8,0,-10,0"
                                Style="{DynamicResource Style.DataGridColumnHeader.Thumb}"/>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="Role" Value="Floating">
                <Setter Property="Opacity" Value="0.7"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="GridViewColumnHeader">
                            <Canvas Name="PART_FloatingHeaderCanvas">
                                <Rectangle Fill="#60000000" Width="{TemplateBinding ActualWidth}" Height="{TemplateBinding ActualHeight}"/>
                            </Canvas>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="Role" Value="Padding">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="GridViewColumnHeader">
                            <Border 
                                Name="HeaderBorder"
                                BorderThickness="0,1,0,1"
                                BorderBrush="Transparent"
                                Background="Transparent"/>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource Brush.DataGridColumnHeader.MouseOver.Background}" />
                <Setter Property="Foreground" Value="{DynamicResource Brush.DataGridColumnHeader.MouseOver.Foreground}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{DynamicResource Brush.DataGridColumnHeader.Pressed.Background}" />
                <Setter Property="Foreground" Value="{DynamicResource Brush.DataGridColumnHeader.Pressed.Foreground}" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>